/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Clases;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author user
 */
@Entity
@Table(name = "bus")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Bus.findAll", query = "SELECT b FROM Bus b"),
    @NamedQuery(name = "Bus.findByCodBus", query = "SELECT b FROM Bus b WHERE b.codBus = :codBus"),
    @NamedQuery(name = "Bus.findByNChasis", query = "SELECT b FROM Bus b WHERE b.nChasis = :nChasis"),
    @NamedQuery(name = "Bus.findByMarca", query = "SELECT b FROM Bus b WHERE b.marca = :marca"),
    @NamedQuery(name = "Bus.findByModelo", query = "SELECT b FROM Bus b WHERE b.modelo = :modelo"),
    @NamedQuery(name = "Bus.findByEmpresaAdscrita", query = "SELECT b FROM Bus b WHERE b.empresaAdscrita = :empresaAdscrita"),
    @NamedQuery(name = "Bus.findByTipoVehiculo", query = "SELECT b FROM Bus b WHERE b.tipoVehiculo = :tipoVehiculo")})
public class Bus implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "cod_bus")
    private String codBus;
    @Basic(optional = false)
    @Column(name = "n_chasis")
    private String nChasis;
    @Basic(optional = false)
    @Column(name = "marca")
    private String marca;
    @Basic(optional = false)
    @Column(name = "modelo")
    private String modelo;
    @Basic(optional = false)
    @Column(name = "empresa_adscrita")
    private String empresaAdscrita;
    @Basic(optional = false)
    @Column(name = "tipo_vehiculo")
    private String tipoVehiculo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codbus")
    private List<Turno> turnoList;

    public Bus() {
    }

    public Bus(String codBus) {
        this.codBus = codBus;
    }

    public Bus(String codBus, String nChasis, String marca, String modelo, String empresaAdscrita, String tipoVehiculo) {
        this.codBus = codBus;
        this.nChasis = nChasis;
        this.marca = marca;
        this.modelo = modelo;
        this.empresaAdscrita = empresaAdscrita;
        this.tipoVehiculo = tipoVehiculo;
    }

    public String getCodBus() {
        return codBus;
    }

    public void setCodBus(String codBus) {
        this.codBus = codBus;
    }

    public String getNChasis() {
        return nChasis;
    }

    public void setNChasis(String nChasis) {
        this.nChasis = nChasis;
    }

    public String getMarca() {
        return marca;
    }

    public void setMarca(String marca) {
        this.marca = marca;
    }

    public String getModelo() {
        return modelo;
    }

    public void setModelo(String modelo) {
        this.modelo = modelo;
    }

    public String getEmpresaAdscrita() {
        return empresaAdscrita;
    }

    public void setEmpresaAdscrita(String empresaAdscrita) {
        this.empresaAdscrita = empresaAdscrita;
    }

    public String getTipoVehiculo() {
        return tipoVehiculo;
    }

    public void setTipoVehiculo(String tipoVehiculo) {
        this.tipoVehiculo = tipoVehiculo;
    }

    @XmlTransient
    public List<Turno> getTurnoList() {
        return turnoList;
    }

    public void setTurnoList(List<Turno> turnoList) {
        this.turnoList = turnoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codBus != null ? codBus.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Bus)) {
            return false;
        }
        Bus other = (Bus) object;
        if ((this.codBus == null && other.codBus != null) || (this.codBus != null && !this.codBus.equals(other.codBus))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Clases.Bus[ codBus=" + codBus + " ]";
    }
    
}
